<div>
  <div class="main-title">
    <h2>{if $id}编辑{else}新增{/if}租客档案</h2>
  </div>
  <div class="main-section">
    <form method="POST" action="{:url('save')}" class="j-form">
      <ul class="form-group form-inline">
        <li>
          <input type="text" class="form-control" name="house_property_name" value="{$data.house_property_name}" data-toggle="tooltip"
            data-placement="top" required readonly>
          <label>房产</label>
        </li>
        <li>
          <select name="house_number_id" class="form-control" style="min-width: 196px;">
            <option value="0">未选择</option>
            {foreach $number as $v}
            <option value="{$v.id}" {if $v.id===$data.house_number_id}selected{/if}>{$v.name}</option>
            {/foreach}
          </select>
          <label>房号</label>
        </li>
        <li>
          <input type="text" class="form-control" name="name" value="{$data.name}" data-toggle="tooltip"
            data-placement="top" required>
          <label>姓名</label>
        </li>
        <li>
          <input type="text" class="form-control" name="sex" value="{$data.sex}" data-toggle="tooltip"
            data-placement="top" required>
          <label>性别</label>
        </li>
        <li>
          <input type="text" class="form-control" name="phone" value="{$data.phone}" data-toggle="tooltip"
            data-placement="top">
          <label>电话号码</label>
        </li>
        <li>
          <input type="text" class="form-control" name="id_card_number" value="{$data.id_card_number}" data-toggle="tooltip"
          data-placement="top">
          <label>身份证</label>
        </li>
        <li>
          <input type="text" class="form-control" name="native_place" value="{$data.native_place}" data-toggle="tooltip"
            data-placement="top">
          <label>籍贯</label>
        </li>
        <li>
          <input type="text" class="form-control" name="work_units" value="{$data.work_units}" data-toggle="tooltip"
            data-placement="top">
          <label>工作单位</label>
        </li>
        <li>
          <input type="text" class="form-control" name="checkin_time" value="{$data.checkin_time|default=time()||date='Y-m-d'}" data-toggle="tooltip"
            data-placement="top" required>
          <label>入住时间</label>
        </li>
        <li>
          <input type="hidden" name="id" value="{$id}">
          <input type="hidden" name="house_property_id" value="{$data.house_property_id}">
          <input type="submit" value="提交表单" class="btn btn-primary">
          <a href="{:url('index', ['house_property_id' => $data.house_property_id])}" class="btn btn-default">返回列表</a>
        </li>
      </ul>
    </form>
  </div>
</div>

<script>
  main.ajaxForm('.j-form', function () {
    main.content("{:url('index', ['house_property_id' => $data.house_property_id])}");
  });
  $('[data-toggle="tooltip"]').tooltip();
</script>